const express=require('express')
// 创建一个应用程序
const bodyParser= require('body-parser')
const adminRouter= require('./router/admin')
const cateRouter= require('./router/cate')
const itemRouter= require('./router/item')
const uploadRouter=require('./router/upload')
const path =require('path')
require('./model/connect')




const app=express()
//创建一个路由

app.use(bodyParser.urlencoded({extended:false}))
app.use(bodyParser.json())
app.use('/static',express.static(path.join(__dirname,"public")))


app.set("views",path.join(__dirname,"views"))
app.set("view engine","ejs")





app.use(adminRouter)
app.use(cateRouter)
app.use(itemRouter)
app.use(uploadRouter)




app.listen(3000,()=>{
    console.log("demo项目启动")
})
//给应用程序分配端口